

import React from 'react';
import { Select } from 'antd';


type DatItem = {
  id: string;
  label: string;
  labelEn: string;
  value: string;
};

interface IProps {
  value: string;
  disabled?: boolean;
  onChange(v: any): void;
  options: {
    dataSource?: DatItem[];
  };
}

const TableSelect = ({ options, value, onChange, disabled }: IProps) => {

  return (
    <Select disabled={disabled} size='small' allowClear style={{ width: '100%' }} value={value} onChange={e => {
      onChange(e);
    }} >
      {options.dataSource?.map(item => (
        <Select.Option key={item.value} value={item.value}>
          { (localStorage.i18nextLng === 'en' ? item?.labelEn : item.label) || item.label}
        </Select.Option>
      ))}
    </Select>


  );
};

export default TableSelect;